<script>
import { isFunction } from "lodash";
import comMixin from "./comMixin.js";
export default {
  mixins: [comMixin],
  props: {
    onClick: {
      type: Function,
    },
    type: {
      type: String,
      default: "",
    },
    effect: {
      type: String,
      default: "light",
    },
    tip: {
      type: String,
    },
    color: {
      type: String,
      default: "",
    },
    size: {
      type: String,
      default: "small",
    }
  },
  methods: {
    onBotton(e) {
      if (isFunction(this.onClick)) {
        this.onClick(e);
      } else {
        this.$emit("click", e);
      }
    },
  },
  render() {
    const jsxTag = (
      <el-tag class="aoneui-input" type={this.type} size={this.size} color={this.color} onClick={this.onBotton} effect={this.effect}>
        {this.label}
      </el-tag>
    );
    return !this.tip ? (
      jsxTag
    ) : (
      <el-tooltip effect="dark" content={this.tip} placement="right-start">
        {jsxTag}
      </el-tooltip>
    );
  },
};
</script>
